<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>ctags</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.

See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
  border: 0 }

table.borderless td, table.borderless th {
  /* Override padding for "table.docutils td" with "! important".
     The right padding separates the table cells. */
  padding: 0 0.5em 0 0 ! important }

.first {
  /* Override more specific margin styles with "! important". */
  margin-top: 0 ! important }

.last, .with-subtitle {
  margin-bottom: 0 ! important }

.hidden {
  display: none }

.subscript {
  vertical-align: sub;
  font-size: smaller }

.superscript {
  vertical-align: super;
  font-size: smaller }

a.toc-backref {
  text-decoration: none ;
  color: black }

blockquote.epigraph {
  margin: 2em 5em ; }

dl.docutils dd {
  margin-bottom: 0.5em }

object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
  overflow: hidden;
}

/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
  font-weight: bold }
*/

div.abstract {
  margin: 2em 5em }

div.abstract p.topic-title {
  font-weight: bold ;
  text-align: center }

div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
  margin: 2em ;
  border: medium outset ;
  padding: 1em }

div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
  font-weight: bold ;
  font-family: sans-serif }

div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
  color: red ;
  font-weight: bold ;
  font-family: sans-serif }

/* Uncomment (and remove this text!) to get reduced vertical space in
   compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
  margin-bottom: 0.5em }

div.compound .compound-last, div.compound .compound-middle {
  margin-top: 0.5em }
*/

div.dedication {
  margin: 2em 5em ;
  text-align: center ;
  font-style: italic }

div.dedication p.topic-title {
  font-weight: bold ;
  font-style: normal }

div.figure {
  margin-left: 2em ;
  margin-right: 2em }

div.footer, div.header {
  clear: both;
  font-size: smaller }

div.line-block {
  display: block ;
  margin-top: 1em ;
  margin-bottom: 1em }

div.line-block div.line-block {
  margin-top: 0 ;
  margin-bottom: 0 ;
  margin-left: 1.5em }

div.sidebar {
  margin: 0 0 0.5em 1em ;
  border: medium outset ;
  padding: 1em ;
  background-color: #ffffee ;
  width: 40% ;
  float: right ;
  clear: right }

div.sidebar p.rubric {
  font-family: sans-serif ;
  font-size: medium }

div.system-messages {
  margin: 5em }

div.system-messages h1 {
  color: red }

div.system-message {
  border: medium outset ;
  padding: 1em }

div.system-message p.system-message-title {
  color: red ;
  font-weight: bold }

div.topic {
  margin: 2em }

h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
  margin-top: 0.4em }

h1.title {
  text-align: center }

h2.subtitle {
  text-align: center }

hr.docutils {
  width: 75% }

img.align-left, .figure.align-left, object.align-left, table.align-left {
  clear: left ;
  float: left ;
  margin-right: 1em }

img.align-right, .figure.align-right, object.align-right, table.align-right {
  clear: right ;
  float: right ;
  margin-left: 1em }

img.align-center, .figure.align-center, object.align-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

table.align-center {
  margin-left: auto;
  margin-right: auto;
}

.align-left {
  text-align: left }

.align-center {
  clear: both ;
  text-align: center }

.align-right {
  text-align: right }

/* reset inner alignment in figures */
div.align-right {
  text-align: inherit }

/* div.align-center * { */
/*   text-align: left } */

.align-top    {
  vertical-align: top }

.align-middle {
  vertical-align: middle }

.align-bottom {
  vertical-align: bottom }

ol.simple, ul.simple {
  margin-bottom: 1em }

ol.arabic {
  list-style: decimal }

ol.loweralpha {
  list-style: lower-alpha }

ol.upperalpha {
  list-style: upper-alpha }

ol.lowerroman {
  list-style: lower-roman }

ol.upperroman {
  list-style: upper-roman }

p.attribution {
  text-align: right ;
  margin-left: 50% }

p.caption {
  font-style: italic }

p.credits {
  font-style: italic ;
  font-size: smaller }

p.label {
  white-space: nowrap }

p.rubric {
  font-weight: bold ;
  font-size: larger ;
  color: maroon ;
  text-align: center }

p.sidebar-title {
  font-family: sans-serif ;
  font-weight: bold ;
  font-size: larger }

p.sidebar-subtitle {
  font-family: sans-serif ;
  font-weight: bold }

p.topic-title {
  font-weight: bold }

pre.address {
  margin-bottom: 0 ;
  margin-top: 0 ;
  font: inherit }

pre.literal-block, pre.doctest-block, pre.math, pre.code {
  margin-left: 2em ;
  margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}

span.classifier {
  font-family: sans-serif ;
  font-style: oblique }

span.classifier-delimiter {
  font-family: sans-serif ;
  font-weight: bold }

span.interpreted {
  font-family: sans-serif }

span.option {
  white-space: nowrap }

span.pre {
  white-space: pre }

span.problematic {
  color: red }

span.section-subtitle {
  /* font-size relative to parent (h1..h6 element) */
  font-size: 80% }

table.citation {
  border-left: solid 1px gray;
  margin-left: 1px }

table.docinfo {
  margin: 2em 4em }

table.docutils {
  margin-top: 0.5em ;
  margin-bottom: 0.5em }

table.footnote {
  border-left: solid 1px black;
  margin-left: 1px }

table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
  padding-left: 0.5em ;
  padding-right: 0.5em ;
  vertical-align: top }

table.docutils th.field-name, table.docinfo th.docinfo-name {
  font-weight: bold ;
  text-align: left ;
  white-space: nowrap ;
  padding-left: 0 }

/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
  border: 0px;
  border-top: 2px solid;
  border-bottom: 2px solid;
  border-collapse: collapse;
}
table.docutils.booktabs * {
  border: 0px;
}
table.docutils.booktabs th {
  border-bottom: thin solid;
  text-align: left;
}

h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
  font-size: 100% }

ul.auto-toc {
  list-style-type: none }

</style>
</head>
<body>
<div class="document" id="ctags">
<span id="ctags-1"></span>
<h1 class="title">ctags</h1>
<h2 class="subtitle" id="generate-tag-files-for-source-code">Generate tag files for source code</h2>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Version:</th>
<td>0.0.0</td></tr>
<tr class="manual-group field"><th class="docinfo-name">Manual group:</th><td class="field-body">Universal-ctags</td>
</tr>
<tr class="manual-section field"><th class="docinfo-name">Manual section:</th><td class="field-body">1</td>
</tr>
</tbody>
</table>
<div class="section" id="synopsis">
<h1>SYNOPSIS</h1>
<div class="line-block">
<div class="line"><strong>ctags</strong> [options] [source_file(s)]</div>
<div class="line"><strong>etags</strong> [options] [source_file(s)]</div>
</div>
</div>
<div class="section" id="description">
<h1>DESCRIPTION</h1>
<p>The <strong>ctags</strong> and <strong>etags</strong> programs
(hereinafter collectively referred to as ctags,
except where distinguished) generate an index (or &quot;tag&quot;) file for a
variety of <strong>language objects</strong> found in <strong>source file(s)</strong>. This tag file allows
these items to be quickly and easily located by a text editor or other
utilities (<strong>client tools</strong>). A <strong>tag</strong> signifies a language object for which an index entry is
available (or, alternatively, the index entry created for that object).</p>
<p>Alternatively, ctags can generate a cross reference
file which lists, in human readable form, information about the various
language objects found in a set of source files.</p>
<p>Tag index files are supported by numerous editors, which allow the user to
locate the object associated with a name appearing in a source file and
jump to the file and line which defines the name. See the manual of your
favorite editor about utilizing ctags command and
the tag index files in the editor.</p>
<p>ctags is capable of generating different <strong>kinds</strong> of tags
for each of many different <strong>languages</strong>. For a complete list of supported
languages, the names by which they are recognized, and the kinds of tags
which are generated for each, see the <tt class="docutils literal"><span class="pre">--list-languages</span></tt> and <tt class="docutils literal"><span class="pre">--list-kinds</span></tt>
options.</p>
<p>This man page describes <strong>Universal-ctags</strong>, an implementation of ctags
derived from <strong>Exuberant-ctags</strong>. The major incompatible changes between
Universal-ctags and Exuberant-ctags are enumerated in
ctags-incompatibilities(7).</p>
<p>One of the advantages of Exuberant-ctags is that it allows a user to
define a new parser from command line. Extending this feature is one
of the major topics in Universal-ctags development. ctags-optlib(7)
describes how the feature is extended.</p>
<p>Newly introduced premature features are not explained here. If you
are interested in such features and ctags internal,
visit <a class="reference external" href="http://docs.ctags.io/en/latest/">http://docs.ctags.io/en/latest/</a>.</p>
</div>
<div class="section" id="source-files">
<h1>SOURCE FILES</h1>
<p>Unless the <tt class="docutils literal"><span class="pre">--language-force</span></tt> option is specified, the language of each source
file is automatically selected based upon a <strong>mapping</strong> of file names to
languages. The mappings in effect for each language may be displayed using
the <tt class="docutils literal"><span class="pre">--list-maps</span></tt> option and may be changed using the <tt class="docutils literal"><span class="pre">--langmap</span></tt> option. On
platforms which support it, if the name of a file is not mapped to a
language, ctags tries to guess the language for
the file by inspecting its content. See &quot;Guessing parser&quot;.</p>
<p>All files that have no file name mapping and no guessed parser are
ignored. This permits running ctags on all files in
either a single directory (e.g.  &quot;ctags *&quot;), or on
all files in an entire source directory tree
(e.g. &quot;ctags -R&quot;), since only those files whose
names are mapped to languages will be scanned.</p>
<p>The same extensions are mapped to multiple parsers. For example, &quot;.h&quot;
are mapped to C++, C and ObjectiveC. These mappings can cause a
trouble. ctags tries to select the proper parser
for the source file by applying kinds of heuristics to its content. However,
it is not perfect.  In that case use <tt class="docutils literal"><span class="pre">--language-force=language</span></tt>,
<tt class="docutils literal"><span class="pre">--langmap=map[,map[...]]</span></tt>, or <tt class="docutils literal"><span class="pre">--map-&lt;LANG&gt;=-pattern|extension</span></tt>
options. (The heuristics are applied either <tt class="docutils literal"><span class="pre">--guess-language-eagerly</span></tt> is
given or not.)</p>
<!-- options should be revised here
``- -map-<LANG>`` (done)
``- -langmap=map[,map[...]]`` (done)
``- -language-force=language`` (done)
``- -languages=[+|-]list`` (done)
``- -list-maps[=language|all]`` (done)
``- -list-map-extensions`` (done)
``- -list-map-patterns`` (done) -->
<div class="section" id="guessing-parser">
<h2>Guessing parser</h2>
<p>If ctags cannot select a parser from the mapping of file names,
various tests are conducted for the guessing:</p>
<dl class="docutils">
<dt>template file name testing</dt>
<dd>If the file name has &quot;.in&quot; extension, apply the mapping to the file
name without the extension. For example, &quot;config.h&quot; is tested for a file
named &quot;config.h.in&quot;.</dd>
<dt>&quot;interpreter&quot; testing</dt>
<dd><p class="first">The first line of the file is checked to see if the file is a &quot;#!&quot;
script for a recognized language.  ctags looks for
a parser having the same name.</p>
<p>If ctags finds no such parser,
ctags looks for the name in alias lists. For
example, consider if the first line is &quot;#!/bin/sh&quot;.  Though
ctags has &quot;shell&quot; parser, it doesn't have &quot;sh&quot;
parser. However, &quot;sh&quot; is listed as an alias for &quot;shell&quot;,
ctags selects the &quot;shell&quot; parser for the file.</p>
<p>An exception is &quot;env&quot;. If &quot;env&quot; is specified, ctags
reads more lines to find real interpreter specification.</p>
<p class="last">To display the list of aliases, use <tt class="docutils literal"><span class="pre">--list-aliases</span></tt> option.
To add/remove an item to/from the list, use <tt class="docutils literal"><span class="pre">--alias-&lt;LANG&gt;=[+|-]aliasPattern</span></tt>
option.</p>
</dd>
<dt>&quot;zsh autoload tag&quot; testing</dt>
<dd>If the first line is started with &quot;#compdef&quot; or &quot;#autoload&quot;,
ctags regards the line as &quot;zsh&quot;.</dd>
<dt>&quot;emacs mode at the first line&quot; testing</dt>
<dd><p class="first">Emacs editor has multiple editing modes specialized to programming
languages. Emacs can recognize a marker called modeline in a file
and utilize the marker for the mode selection. This testing does
the same as what Emacs does.</p>
<p>ctags treats <em>MODE</em> as a name of interpreter and applies the same
rule of &quot;interpreter&quot; testing if the first line has one of
the following patterns:</p>
<pre class="literal-block">
-*- mode: MODE -*-
</pre>
<p>or</p>
<pre class="last literal-block">
-*- MODE -*-
</pre>
</dd>
<dt>&quot;emacs mode at the EOF&quot; testing</dt>
<dd><p class="first">Emacs editor recognizes another marker at the end of file as a
mode specifier. This testing does the same as what Emacs does.</p>
<p>ctags treats <em>MODE</em> as a name of interpreter and applies the same
rule of &quot;interpreter&quot; testing if the lines at the tail of the file
have the following pattern:</p>
<pre class="literal-block">
Local Variables:
...
mode: MODE
...
End:
</pre>
<p class="last">3000 characters are sought from the end of file to find the pattern.</p>
</dd>
<dt>&quot;vim modeline&quot; testing</dt>
<dd><p class="first">Like the modeline of Emacs editor, Vim editor has the same concept.
ctags treats <em>TYPE</em> as a name of interpreter and applies the same
rule of &quot;interpreter&quot; testing if the last 5 lines of the file
have one of the following patterns:</p>
<pre class="literal-block">
filetype=TYPE
</pre>
<p>or</p>
<pre class="last literal-block">
ft=TYPE
</pre>
</dd>
<dt>&quot;PHP marker&quot; testing</dt>
<dd>If the first line is started with &quot;&lt;?php&quot;,
ctags regards the line as &quot;php&quot;.</dd>
</dl>
<p>Looking into the file contents is more expensive operation than file
name matching. So ctags runs the testings in limited
conditions.  &quot;interpreter&quot; testing is enabled only when a file is
executable or <tt class="docutils literal"><span class="pre">--guess-language-eagerly</span></tt> (<tt class="docutils literal"><span class="pre">-G</span></tt> in short) option is
given. The other testings are enabled only when <tt class="docutils literal"><span class="pre">-G</span></tt> option is
given.</p>
<p><tt class="docutils literal"><span class="pre">--print-language</span></tt> can be used just for printing the results of
parser selections for given files instead of making tags file.</p>
<p>Examples:</p>
<pre class="code console literal-block">
<span class="generic prompt">$</span> ctags --print-language config.h.in input.m input.unknown
<span class="generic output">config.h.in: C++
input.m: MatLab
input.unknown: NONE</span>
</pre>
<p><tt class="docutils literal">NONE</tt> means that ctags does not select any parser for the file.</p>
<!-- options should be explained and revised here
``- -list-aliases=`` (done)
``- -alias-<LANG>=`` (done) -->
</div>
</div>
<div class="section" id="tag-entries">
<h1>TAG ENTRIES</h1>
<p>A tag is an index for a language object. Concepts of tag and related
things in Exuberant-ctags are refined and extended in Universal-ctags.</p>
<p>A tag is categorized into <strong>definition tags</strong> or <strong>reference tags</strong>.
Though some exceptions are, Exuberant-ctags tags only definitions of
language objects; it tags language objects introducing new names in
source files. In addition, Universal-ctags has infrastructure for
tagging references of language objects. However, the area where
reference tags are implemented is very limited in the current version.</p>
<div class="section" id="fields">
<h2>Fields</h2>
<p>A tag can has various information. They are called <strong>fields</strong>. The
essential fields are <strong>name</strong> of language objects, <strong>input</strong>,
<strong>pattern</strong>, and <strong>line</strong>. <tt class="docutils literal">input:</tt> is the name of source file where
<tt class="docutils literal">name:</tt> is defined or referenced. <tt class="docutils literal">pattern:</tt> can be used to search
the <cite>**name**`</cite> in <tt class="docutils literal">input:</tt>. <strong>line</strong> is the line number where
<tt class="docutils literal">name:</tt> is defined or referenced in
<tt class="docutils literal">input:</tt>.</p>
<p>ctags offers extension fields. See also the
descriptions of <tt class="docutils literal"><span class="pre">--list-fields</span></tt> option and <tt class="docutils literal"><span class="pre">--fields</span></tt> option.</p>
</div>
<div class="section" id="kinds">
<h2>Kinds</h2>
<p><tt class="docutils literal">kind:</tt> is a field which represents the <em>kind</em> of language object
specified by a tag. Kinds used and defined are very different between
parsers. For example, C language defines &quot;macro&quot;, &quot;function&quot;,
&quot;variable&quot;, &quot;typedef&quot;, etc. See also the descriptions of
<tt class="docutils literal"><span class="pre">--list-kinds</span></tt> option and <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;</span></tt> option.</p>
</div>
<div class="section" id="extras">
<h2>Extras</h2>
<p>BASICALLY, ctags tags only language objects appeared
on source files as is. In other words, a value for a <tt class="docutils literal">name:</tt> field
should be found on the source file associated with the <tt class="docutils literal">name:</tt>.  An
extra tag (<em>extra</em>) is for tagging a language object with processed
name or for tagging not associated with a language object. Typical
extra tag is &quot;qualified&quot;. That tags a language object with
class-qualified or scope-qualified name.</p>
<p>The following example demonstrates &quot;qualified&quot; extra tag.</p>
<pre class="code Java literal-block">
<span class="keyword namespace">package</span> <span class="name namespace">Bar</span><span class="operator">;</span>
<span class="keyword namespace">import</span> <span class="name namespace">Baz</span><span class="operator">;</span>

<span class="keyword declaration">class</span> <span class="name class">Foo</span> <span class="operator">{</span>
        <span class="comment single">// ...
</span><span class="operator">}</span>
</pre>
<p>For the source file, ctags tags &quot;Bar&quot; and &quot;Foo&quot; by
default.  If &quot;qualified&quot; extra is enabled from command line, &quot;Bar.Foo&quot;
is also tagged though the string &quot;Bar.Foo&quot; is not in the source code.</p>
<p>See also the descriptions of <tt class="docutils literal"><span class="pre">--list-extras</span></tt> option and <tt class="docutils literal"><span class="pre">--extras</span></tt>
option.</p>
</div>
<div class="section" id="roles">
<h2>Roles</h2>
<p><em>Role</em> is a newly introduced concept in Universal-ctags. Role is a
concept related with reference tags. Role is not for definition
tags. Role is not implemented widely yet.</p>
<p>A kind represents what is the language object specified with a tag.  A
role is introduced for representing how the language object specified
with a tag is referenced. Roles are defined in a kind.</p>
<p>For the source file used for demonstrating in &quot;Extras&quot; subsection,
&quot;Baz&quot; is tagged as a reference tag with kind &quot;package&quot; and with
role &quot;imported&quot;.</p>
<p>See also the descriptions of <tt class="docutils literal"><span class="pre">--list-roles</span></tt> option.</p>
</div>
<div class="section" id="language-own-fields-and-extras">
<h2>Language own fields and extras</h2>
<p>Exuberant-ctags has concepts of fields and extras. They are common
between parsers. In addition, Universal-ctags provides language own
fields and extras.</p>
<!-- options should be explained and revised here
``- -list-languages`` (done)
``- -list-kinds``     (done)
``- -list-kinds-full``(done)
``- -list-fields``    (done)
``- -list-extras``    (done)
``- -list-roles``     (done)
``- -kinds-<LANG>=``  (done)
``- -fields=``        (done)
``- -fields-<LANG>``  (done)
``- -extras=``        (done)
``- -extras-<LANG>=`` (done) -->
</div>
</div>
<div class="section" id="command-line-interface">
<h1>COMMAND LINE INTERFACE</h1>
<p>Despite the wealth of available options, defaults are set so that
ctags is most commonly executed without any options (e.g.
&quot;ctags *&quot;, or &quot;ctags -R&quot;), which will
create a tag file in the current directory for all recognized source
files. The options described below are provided merely to allow custom
tailoring to meet special needs.</p>
<p>Note that spaces separating the single-letter options from their parameters
are optional.</p>
<p>Note also that the boolean parameters to the long form options (those
beginning with &quot;--&quot; and that take a &quot;[=yes|no]&quot; parameter) may be omitted,
in which case &quot;=yes&quot; is implied. (e.g. <tt class="docutils literal"><span class="pre">--sort</span></tt> is equivalent to <tt class="docutils literal"><span class="pre">--sort=yes</span></tt>).
Note further that &quot;=1&quot;, &quot;=on&quot;, and &quot;=true&quot; are considered synonyms for &quot;=yes&quot;,
and that &quot;=0&quot;, &quot;=off&quot;, and &quot;=false&quot; are considered synonyms for &quot;=no&quot;.</p>
<p>Some options are either ignored or useful only when used while running in
etags mode (see -e option). Such options will be noted.</p>
<p>Most options may appear anywhere on the command line, affecting only those
files which follow the option. A few options, however, must appear
before the first file name and will be noted as such.</p>
<p>Options taking language names will accept those names in either upper or
lower case. See the <tt class="docutils literal"><span class="pre">--list-languages</span></tt> option for a complete list of the
built-in language names.</p>
<div class="section" id="letters-and-names">
<h2>Letters and names</h2>
<p>Some options take letters as parameters (e.g. <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;</span></tt> option).
Specifying just letters help a user make a complicated command line
quickly.  However, the command line including sequence of the letters
becomes difficult to be understood.</p>
<p>Universal-ctags accepts names in
addition to such letters. The names and letters can be mixed in an
option parameter by surrounding each name by braces. Thus, for an
example, following three notations for <tt class="docutils literal"><span class="pre">--kinds-C</span></tt> option have
the same meaning:</p>
<pre class="literal-block">
--kinds-C=+pLl
--kinds-C=+{prototype}{label}{local}
--kinds-C=+{prototype}L{local}
</pre>
<p>Note that braces may be meta characters in your shell. Put
single quotes in such case.</p>
<p><tt class="docutils literal"><span class="pre">--list-...</span></tt> options shows letters and associated names.</p>
</div>
<div class="section" id="list-options">
<h2>List options</h2>
<p>Universal-ctags introduces many <tt class="docutils literal"><span class="pre">--list-...</span></tt> options that provide
the internal data of Universal-ctags. Both users and client tools may
use the data. <tt class="docutils literal"><span class="pre">--with-list-header</span></tt> and <tt class="docutils literal"><span class="pre">--machinable</span></tt> options
adjust the output of the most of <tt class="docutils literal"><span class="pre">--list-...</span></tt> options.</p>
<p>The default setting (<tt class="docutils literal"><span class="pre">--with-list-header=yes</span></tt> and <tt class="docutils literal"><span class="pre">--machinable=no</span></tt>)
is for using interactively from a terminal. The header that explains
the meaning of columns is simply added to the output, and each column is
aligned in all lines. The header line starts with a hash ('#') character.</p>
<p>For scripting in a client tool, <tt class="docutils literal"><span class="pre">--with-list-header=no</span></tt> and
<tt class="docutils literal"><span class="pre">--machinable=yes</span></tt> may be useful. The header is not added to the
output, and each column is separated by tab characters.</p>
<p>Note the order of columns will change in the future release.
However, labels in the header will not change. So by scanning
the header, a client tool can find the index for the target
column.</p>
<!-- options should be explained and revised here
``- -list-features``    (done)
``- -machinable``       (done)
``- -with-list-header`` (done) -->
</div>
</div>
<div class="section" id="option-items">
<h1>OPTION ITEMS</h1>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">-a</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--append</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-B</span></tt></dt>
<dd>Use backward searching patterns (e.g. ?pattern?). [Ignored in etags mode]</dd>
<dt><tt class="docutils literal"><span class="pre">-e</span></tt></dt>
<dd>Enable etags mode, which will create a tag file for use with the Emacs
editor. Alternatively, if ctags is invoked by a
name containing the string &quot;etags&quot; (either by renaming,
or creating a link to, the executable), etags mode will be enabled.
This option must appear before the first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">-f</span> tagfile</tt></dt>
<dd>Use the name specified by tagfile for the tag file (default is &quot;tags&quot;,
or &quot;TAGS&quot; when running in etags mode). If tagfile is specified as &quot;-&quot;,
then the tag file is written to standard output instead. ctags
will stubbornly refuse to take orders if tagfile exists and
its first line contains something other than a valid tags line. This
will save your neck if you mistakenly type &quot;ctags -f
*.c&quot;, which would otherwise overwrite your first C file with the tags
generated by the rest! It will also refuse to accept a multi-character
file name which begins with a '-' (dash) character, since this most
likely means that you left out the tag file name and this option tried to
grab the next option as the file name. If you really want to name your
output tag file &quot;-ugly&quot;, specify it as &quot;./-ugly&quot;. This option must
appear before the first file name. If this option is specified more
than once, only the last will apply.</dd>
<dt><tt class="docutils literal"><span class="pre">-F</span></tt></dt>
<dd>Use forward searching patterns (e.g. /pattern/) (default). [Ignored
in etags mode]</dd>
<dt><tt class="docutils literal"><span class="pre">-G</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--guess-language-eagerly</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-h</span> list</tt></dt>
<dd>Specifies a list of file extensions, separated by periods, which are
to be interpreted as include (or header) files. To indicate files having
no extension, use a period not followed by a non-period character
(e.g. &quot;.&quot;, &quot;..x&quot;, &quot;.x.&quot;). This option only affects how the scoping of a
particular kinds of tags is interpreted (i.e. whether or not they are
considered as globally visible or visible only within the file in which
they are defined); it does not map the extension to any particular
language. Any tag which is located in a non-include file and cannot be
seen (e.g. linked to) from another file is considered to have file-limited
(e.g. static) scope. No kind of tag appearing in an include file
will be considered to have file-limited scope. If the first character
in the list is a plus sign, then the extensions in the list will be
appended to the current list; otherwise, the list will replace the
current list. See, also, the <tt class="docutils literal"><span class="pre">--file-scope</span></tt> option. The default list is
&quot;.h.H.hh.hpp.hxx.h++.inc.def&quot;. To restore the default list, specify <tt class="docutils literal"><span class="pre">-h</span></tt>
default. Note that if an extension supplied to this option is not
already mapped to a particular language (see &quot;SOURCE FILES&quot;, above),
you will also need to use either the <tt class="docutils literal"><span class="pre">--langmap</span></tt> or <tt class="docutils literal"><span class="pre">--language-force</span></tt> option.</dd>
<dt><tt class="docutils literal"><span class="pre">-I</span> <span class="pre">identifier-list</span></tt></dt>
<dd><p class="first">Specifies a list of identifiers which are to be specially handled while
parsing C and C++ source files. This option is specifically provided
to handle special cases arising through the use of preprocessor macros.
When the identifiers listed are simple identifiers, these identifiers
will be ignored during parsing of the source files. If an identifier is
suffixed with a '+' character, ctags will also
ignore any parenthesis-enclosed argument list which may immediately
follow the identifier in the source files. If two identifiers are
separated with the '=' character, the first identifiers is replaced by
the second identifiers for parsing purposes. The list of identifiers may
be supplied directly on the command line or read in from a separate file.
If the first character of identifier-list is '&#64;', '.' or a pathname
separator ('/' or ''), or the first two characters specify a drive
letter (e.g. &quot;C:&quot;), the parameter identifier-list will be interpreted as
a filename from which to read a list of identifiers, one per input line.
Otherwise, identifier-list is a list of identifiers (or identifier
pairs) to be specially handled, each delimited by either a comma or
by white space (in which case the list should be quoted to keep the
entire list as one command line argument). Multiple <tt class="docutils literal"><span class="pre">-I</span></tt> options may be
supplied. To clear the list of ignore identifiers, supply a single
dash (&quot;-&quot;) for identifier-list.</p>
<p>This feature is useful when preprocessor macros are used in such a way
that they cause syntactic confusion due to their presence. Indeed,
this is the best way of working around a number of problems caused by
the presence of syntax-busting macros in source files (see &quot;CAVEATS&quot;).
Some examples will illustrate this point.</p>
<pre class="code C literal-block">
<span class="keyword type">int</span> <span class="name">foo</span> <span class="name">ARGDECL4</span><span class="punctuation">(</span><span class="keyword type">void</span> <span class="operator">*</span><span class="punctuation">,</span> <span class="name">ptr</span><span class="punctuation">,</span> <span class="keyword type">long</span> <span class="keyword type">int</span><span class="punctuation">,</span> <span class="name">nbytes</span><span class="punctuation">)</span>
</pre>
<p>In the above example, the macro &quot;ARGDECL4&quot; would be mistakenly
interpreted to be the name of the function instead of the correct name
of &quot;foo&quot;. Specifying &quot;-I ARGDECL4&quot; results in the correct behavior.</p>
<pre class="code C literal-block">
<span class="comment multiline">/* creates an RCS version string in module */</span>
<span class="name">MODULE_VERSION</span><span class="punctuation">(</span><span class="literal string">&quot;$Revision$&quot;</span><span class="punctuation">)</span>
</pre>
<p>In the above example the macro invocation looks too much like a function
definition because it is not followed by a semicolon (indeed, it
could even be followed by a global variable definition that would look
much like a K&amp;R style function parameter declaration). In fact, this
seeming function definition could possibly even cause the rest of the
file to be skipped over while trying to complete the definition.
Specifying &quot;-I MODULE_VERSION+&quot; would avoid such a problem.</p>
<pre class="code C literal-block">
<span class="name">CLASS</span> <span class="name">Example</span> <span class="punctuation">{</span>
        <span class="comment single">// your content here
</span><span class="punctuation">};</span>
</pre>
<p class="last">The example above uses &quot;CLASS&quot; as a preprocessor macro which expands to
something different for each platform. For instance CLASS may be
defined as &quot;class __declspec(dllexport)&quot; on Win32 platforms and simply
&quot;class&quot; on UNIX. Normally, the absence of the C++ keyword &quot;class&quot;
would cause the source file to be incorrectly parsed. Correct behavior
can be restored by specifying &quot;-I CLASS=class&quot;.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">-L</span> file</tt></dt>
<dd>Read from file a list of file names for which tags should be generated.
If file is specified as &quot;-&quot;, then file names are read from standard
input. File names read using this option are processed following file
names appearing on the command line. Options are also accepted in this
input. If this option is specified more than once, only the last will
apply. Note: file is read in line-oriented mode, where a new line is
the only delimiter and non-trailing white space is considered significant,
in order that file names containing spaces may be supplied
(however, trailing white space is stripped from lines); this can affect
how options are parsed if included in the input.</dd>
<dt><tt class="docutils literal"><span class="pre">-n</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--excmd=number</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-N</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--excmd=pattern</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-o</span> tagfile</tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">-f</span> tagfile</tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-R</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--recurse</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-u</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--sort=no</span></tt> (i.e. &quot;unsorted&quot;).</dd>
<dt><tt class="docutils literal"><span class="pre">-V</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--verbose</span></tt>.</dd>
<dt><tt class="docutils literal"><span class="pre">-w</span></tt></dt>
<dd>This option is silently ignored for backward-compatibility with the
ctags of SVR4 Unix.</dd>
<dt><tt class="docutils literal"><span class="pre">-x</span></tt></dt>
<dd>Print a tabular, human-readable cross reference (xref) file to standard
output instead of generating a tag file. The information contained in
the output includes: the tag name; the kind of tag; the line number,
file name, and source line (with extra white space condensed) of the
file which defines the tag. No tag file is written and all options
affecting tag file output will be ignored. Example applications for this
feature are generating a listing of all functions located in a source
file (e.g. &quot;ctags -x --c-kinds=f file&quot;), or generating
a list of all externally visible global variables located in a source
file (e.g. &quot;ctags -x --c-kinds=v --file-scope=no file&quot;).
This option must appear before the first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">--alias-&lt;LANG&gt;=[+|-]aliasPattern</span></tt></dt>
<dd><p class="first">Adds ('+') or removes ('-') an alias pattern to a language specified
with <em>&lt;LANG&gt;</em>. ctags refers the alias pattern in
&quot;Guessing parser&quot; stage.</p>
<p>The parameter aliasPattern is not a list. Use this option multiple
times in a command line to add or remove multiple alias
patterns.</p>
<p>To restore the default language aliases, specify &quot;default&quot; as the
parameter aliasPattern. Using &quot;all&quot; for <em>&lt;LANG&gt;</em> has meaning in
following two cases:</p>
<dl class="last docutils">
<dt>&quot;--alias-all=&quot;</dt>
<dd>This clears aliases setting of all languages.</dd>
<dt>&quot;--alias-all=default&quot;</dt>
<dd>This restores the default languages aliases for all languages.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--append[=yes|no]</span></tt></dt>
<dd>Indicates whether tags generated from the specified files should be
appended to those already present in the tag file or should replace them.
This option is off by default. This option must appear before the
first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">--etags-include=file</span></tt></dt>
<dd>Include a reference to file in the tag file. This option may be specified
as many times as desired. This supports Emacs' capability to use a
tag file which &quot;includes&quot; other tag files. [Available only in etags mode]</dd>
<dt><tt class="docutils literal"><span class="pre">--exclude=[pattern]</span></tt></dt>
<dd><p class="first">Add pattern to a list of excluded files and directories. This option may
be specified as many times as desired. For each file name considered
by ctags, each pattern specified using this option
will be compared against both the complete path (e.g.
some/path/base.ext) and the base name (e.g. base.ext) of the file, thus
allowing patterns which match a given file name irrespective of its
path, or match only a specific path. If appropriate support is available
from the runtime library of your C compiler, then pattern may
contain the usual shell wildcards (not regular expressions) common on
Unix (be sure to quote the option parameter to protect the wildcards from
being expanded by the shell before being passed to ctags;
also be aware that wildcards can match the slash character, '/').
You can determine if shell wildcards are available on your platform by
examining the output of the <tt class="docutils literal"><span class="pre">--list-features</span></tt> option, which will include
&quot;wildcards&quot; in the compiled feature list; otherwise, pattern is matched
against file names using a simple textual comparison.</p>
<p class="last">If pattern begins with the character '&#64;', then the rest of the string
is interpreted as a file name from which to read exclusion patterns,
one per line. If pattern is empty, the list of excluded patterns is
cleared. Note that at program startup, the default exclude list contains
&quot;EIFGEN&quot;, &quot;SCCS&quot;, &quot;RCS&quot;, and &quot;CVS&quot;, which are names of directories for
which it is generally not desirable to descend while processing the
<tt class="docutils literal"><span class="pre">--recurse</span></tt> option.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--excmd=type</span></tt></dt>
<dd><p class="first">Determines the type of EX command used to locate tags in the source
file. [Ignored in etags mode]</p>
<p>The valid values for type (either the entire word or the first letter
is accepted) are:</p>
<dl class="last docutils">
<dt>number</dt>
<dd><p class="first">Use only line numbers in the tag file for locating tags. This has
four advantages:</p>
<ol class="arabic simple">
<li>Significantly reduces the size of the resulting tag file.</li>
<li>Eliminates failures to find tags because the line defining the
tag has changed, causing the pattern match to fail (note that
some editors, such as vim, are able to recover in many such
instances).</li>
<li>Eliminates finding identical matching, but incorrect, source
lines (see &quot;BUGS&quot;).</li>
<li>Retains separate entries in the tag file for lines which are
identical in content. In pattern mode, duplicate entries are
dropped because the search patterns they generate are identical,
making the duplicate entries useless.</li>
</ol>
<p class="last">However, this option has one significant drawback: changes to the
source files can cause the line numbers recorded in the tag file
to no longer correspond to the lines in the source file, causing
jumps to some tags to miss the target definition by one or more
lines. Basically, this option is best used when the source code
to which it is applied is not subject to change. Selecting this
option type causes the following options to be ignored: <tt class="docutils literal"><span class="pre">-BF</span></tt>.</p>
</dd>
<dt>pattern</dt>
<dd>Use only search patterns for all tags, rather than the line numbers
usually used for macro definitions. This has the advantage of
not referencing obsolete line numbers when lines have been added or
removed since the tag file was generated.</dd>
<dt>mixed</dt>
<dd>In this mode, patterns are generally used with a few exceptions.
For C, line numbers are used for macro definition tags. This was
the default format generated by the original ctags and is, therefore,
retained as the default for this option. For Fortran, line numbers
are used for common blocks because their corresponding source lines
are generally identical, making pattern searches useless
for finding all matches.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--extra=[+|-]flags|*</span></tt></dt>
<dd><p class="first">Equivalent to <tt class="docutils literal"><span class="pre">--extras=[+|-]flags|*</span></tt>, which is introduced to
make the option naming convention align to the other options
like <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;=</span></tt> and <tt class="docutils literal"><span class="pre">--fields=</span></tt>.</p>
<p class="last">This option is kept for backward-compatibility with Exuberant-ctags.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--extras-&lt;LANG&gt;=[+|-]flags|*</span></tt></dt>
<dd><p class="first">Specifies whether to include extra tag entries for certain kinds of
information about &lt;LANG&gt;. Universal-ctags
introduces language own extras. (See &quot;Language own fields and
extras&quot; about the concept). This option is for controlling them.</p>
<p class="last">Specifies &quot;all&quot; as &lt;LANG&gt; to apply the parameter flags to all
extras; all extras are enabled with specifying '*' as the
parameter flags. If specifying nothing as the parameter flags
(&quot;--extras-all=&quot;), all extras are disabled. These two combinations
are useful for testing.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--extras=[+|-]flags|*</span></tt></dt>
<dd><p class="first">Specifies whether to include extra tag entries for certain kinds of
information. See also &quot;Extras&quot; subsection to know what are kinds.</p>
<p>The parameter flags is a set of one-letter flags, each
representing one kind of extra tag entry to include in the tag file.
If flags is preceded by either the '+' or '-' character, the effect of
each flag is added to, or removed from, those currently enabled;
otherwise the flags replace any current settings. All entries are
included  if '*' is given.</p>
<p>This <tt class="docutils literal"><span class="pre">--extras=</span></tt> option is for controlling extras common in
languages (or language in-depends extras).  Universal-ctags
introduces language own extras. (See &quot;Language own fields and
extras&quot; about the concept). Use <tt class="docutils literal"><span class="pre">--extras-&lt;LANG&gt;=</span></tt> option for
controlling them.</p>
<p>The meaning of major extras is as follows (one-letter flag/name):</p>
<dl class="docutils">
<dt>F/fileScope</dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--file-scope</span></tt>.</dd>
<dt>f/inputFile</dt>
<dd>Include an entry for the base file name of every source file
(e.g. &quot;example.c&quot;), which addresses the first line of the file.
If <tt class="docutils literal">end:</tt> field is enabled, the end line number of the file
can be attached to the tag.</dd>
<dt>p/pseudo</dt>
<dd>Include pseudo tags. Enabled by default unless the tag file is
written to standard output.</dd>
<dt>q/qualified</dt>
<dd><p class="first">Include an extra class-qualified or namespace-qualified tag entry
for each tag which is a member of a class or a namespace.</p>
<p>This may allow easier location of a specific tags when
multiple occurrences of a tag name occur in the tag file.
Note, however, that this could potentially more than double
the size of the tag file.</p>
<p>The actual form of the qualified tag depends upon the language
from which the tag was derived (using a form that is most
natural for how qualified calls are specified in the
language). For C++ and Perl, it is in the form
&quot;class::member&quot;; for Eiffel and Java, it is in the form
&quot;class.member&quot;.</p>
<p class="last">Note: Using backslash characters as separators forming
qualified name in PHP. However, in tags output of
Universal-ctags, a backslash character in a name is escaped
with a backslash character.</p>
<!-- TODO: Write about the detail of escaping in somewhere. -->
</dd>
<dt>r/reference</dt>
<dd>Include reference tags. See &quot;TAG ENTRIES&quot; about reference tags.</dd>
</dl>
<p>Inquire the output of <tt class="docutils literal"><span class="pre">--list-extras</span></tt> option for the other minor
extras.</p>
<p class="last">A name associated with an extra can be used as alternative to a
one-letter flag. Some minor extras have no one-letters flag. In
that case, names must be specified anyway. See &quot;Letters and names&quot;
for more details.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--fields-&lt;LANG&gt;=[+|-]flags|*</span></tt></dt>
<dd><p class="first">Specifies the language own fields which are to be included in
the entries of the tag file. Universal-ctags
introduces language own fields. (See &quot;Language own fields and
extras&quot; about the concept). This option is for controlling them.</p>
<p class="last">Specifies &quot;all&quot; as &lt;LANG&gt; to apply the parameter flags to all
fields; all fields are enabled with specifying '*' as the
parameter flags. If specifying nothing as the parameter flags
(&quot;--fields-all=&quot;), all extras are disabled. These two combinations
are useful for testing.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--fields=[+|-]flags|*</span></tt></dt>
<dd><p class="first">Specifies the available extension fields which are to be included in
the entries of the tag file (see &quot;TAG FILE FORMAT&quot;, below, and, &quot;Fields&quot;, above, for more
information).</p>
<p>The parameter flags is a set of one-letter flags,
each representing one type of extension field to include.
Each letter or group of letters may be preceded by either '+' to add it
to the default set, or '-' to exclude it. In the absence of any
preceding '+' or '-' sign, only those fields explicitly listed in flags
will be included in the output (i.e. overriding the default set). All
fields are included if '*' is given. This option is ignored if the
option <tt class="docutils literal"><span class="pre">--format=1</span></tt> has been specified.</p>
<p>This <tt class="docutils literal"><span class="pre">--fields=</span></tt> option is for controlling fields common in
languages (or language in-depends fields).  Universal-ctags
introduces language own fields. (See &quot;Language own fields and
extras&quot; about the concept). Use <tt class="docutils literal"><span class="pre">--fields-&lt;LANG&gt;=</span></tt> option for
controlling them.</p>
<p>The meaning of major fields is as follows (one-letter flag/name):</p>
<dl class="docutils">
<dt>a/access</dt>
<dd>Access (or export) of class members</dd>
<dt>e/end</dt>
<dd>End lines of various items</dd>
<dt>f/file</dt>
<dd>File-restricted scoping. Enabled by default.</dd>
<dt>i/inherits</dt>
<dd>Inheritance information.</dd>
<dt>k</dt>
<dd>Kind of tag as a single letter. Enabled by default.
Exceptionally this has no name.</dd>
<dt>K</dt>
<dd>Kind of tag as full name
Exceptionally this has no name.</dd>
<dt>l/language</dt>
<dd>Language of source file containing tag</dd>
<dt>m/implementation</dt>
<dd>Implementation information</dd>
<dt>n/line</dt>
<dd>Line number of tag definition</dd>
<dt>p/scopeKind</dt>
<dd>Kind of scope as full name</dd>
<dt>r/role</dt>
<dd>Role of reference tag</dd>
<dt>s</dt>
<dd>Scope of tag definition. Enabled by default.
Exceptionally this has no name.</dd>
<dt>S/signature</dt>
<dd>Signature of routine (e.g. prototype or parameter list)</dd>
<dt>t/typeref</dt>
<dd>Type and name of a variable or typedef as &quot;typeref:&quot; field.
Enabled by default.</dd>
<dt>z/kind</dt>
<dd>Include the &quot;kind:&quot; key in kind field</dd>
<dt>Z</dt>
<dd>Include the &quot;scope:&quot; key in scope field.
Exceptionally this has no name.</dd>
</dl>
<p>Inquire the output of <tt class="docutils literal"><span class="pre">--list-fields</span></tt> option for the other minor
fields.</p>
<p class="last">A name associated with a field can be used as alternative to a
one-letter flag. Some minor fields have no one-letters flag. In
that case, names must be specified anyway. See &quot;Letters and names&quot;
for more details.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--file-scope[=yes|no]</span></tt></dt>
<dd><p class="first">Indicates whether tags scoped only for a single file (i.e. tags which
cannot be seen outside of the file in which they are defined, such as
&quot;static&quot; tags) should be included in the output. See, also, the <tt class="docutils literal"><span class="pre">-h</span></tt>
option. This option is enabled by default.</p>
<p class="last">Universal-ctags provides alternative way to control this option,
&quot;F/fileScope&quot; extra, and recommends users to use the
extra. However, this extra can cause a trouble.
See ctags-incompatibilities(7).</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--filter[=yes|no]</span></tt></dt>
<dd>Causes ctags to behave as a filter, reading source
file names from standard input and printing their tags to standard
output on a file-by-file basis. If <tt class="docutils literal"><span class="pre">--sort</span></tt> is enabled, tags are sorted
only within the source file in which they are defined. File names are
read from standard input in line-oriented input mode (see note for <tt class="docutils literal"><span class="pre">-L</span></tt>
option) and only after file names listed on the command line or from
any file supplied using the <tt class="docutils literal"><span class="pre">-L</span></tt> option. When this option is enabled,
the options <tt class="docutils literal"><span class="pre">-f</span></tt>, <tt class="docutils literal"><span class="pre">-o</span></tt>, and <tt class="docutils literal"><span class="pre">--totals</span></tt> are ignored. This option is quite
esoteric and is disabled by default. This option must appear before
the first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">--filter-terminator=string</span></tt></dt>
<dd>Specifies a string to print to standard output following the tags for
each file name parsed when the <tt class="docutils literal"><span class="pre">--filter</span></tt> option is enabled. This may
permit an application reading the output of ctags
to determine when the output for each file is finished. Note that if the
file name read is a directory and <tt class="docutils literal"><span class="pre">--recurse</span></tt> is enabled, this string will
be printed only once at the end of all tags found for by descending
the directory. This string will always be separated from the last tag
line for the file by its terminating newline. This option is quite
esoteric and is empty by default. This option must appear before
the first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">--format=level</span></tt></dt>
<dd>Change the format of the output tag file. Currently the only valid
values for level are 1 or 2. Level 1 specifies the original tag file
format and level 2 specifies a new extended format containing extension
fields (but in a manner which retains backward-compatibility with
original vi(1) implementations). The default level is 2. This option
must appear before the first file name. [Ignored in etags mode]</dd>
<dt><tt class="docutils literal"><span class="pre">--guess-language-eagerly</span></tt></dt>
<dd>Looks into the file contents for guessing the proper parser.
See &quot;Guessing parser&quot;.</dd>
<dt><tt class="docutils literal"><span class="pre">--help</span></tt></dt>
<dd>Prints to standard output a detailed usage description, and then exits.</dd>
<dt><tt class="docutils literal"><span class="pre">--if0[=yes|no]</span></tt></dt>
<dd>Indicates a preference as to whether code within an &quot;#if 0&quot; branch of a
preprocessor conditional should be examined for non-macro tags (macro
tags are always included). Because the intent of this construct is to
disable code, the default value of this option is no. Note that this
indicates a preference only and does not guarantee skipping code within
an &quot;#if 0&quot; branch, since the fall-back algorithm used to generate
tags when preprocessor conditionals are too complex follows all branches
of a conditional. This option is disabled by default.</dd>
<dt><tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;=[+|-]kinds|*</span></tt></dt>
<dd><p class="first">Specifies a list of language-specific kinds of tags (or kinds) to
include in the output file for a particular language, where &lt;LANG&gt; is
case-insensitive and is one of the built-in language names (see the
<tt class="docutils literal"><span class="pre">--list-languages</span></tt> option for a complete list). The parameter kinds is a group
of one-letter flags designating kinds of tags (particular to the language)
to either include or exclude from the output. The specific sets of
flags recognized for each language, their meanings and defaults may be
list using the <tt class="docutils literal"><span class="pre">--list-kinds</span></tt> option. Each letter or group of letters
may be preceded by either '+' to add it to, or '-' to remove it from,
the default set. In the absence of any preceding '+' or '-' sign, only
those kinds explicitly listed in kinds will be included in the output
(i.e. overriding the default for the specified language).</p>
<p>Specifies '*' as the parameter kinds to include all kinds implemented
in &lt;LANG&gt; in the output. Further more if &quot;all&quot; is given as &lt;LANG&gt;,
specification of the parameter kinds affects all languages defined
in ctags. Giving &quot;all&quot; makes sense only when '*' is
given as the parameter kinds.</p>
<p>As an example for the C language, in order to add prototypes and
external variable declarations to the default set of tag kinds,
but exclude macros, use &quot;--c-kinds=+px-d&quot;; to include only tags for
functions, use &quot;--c-kinds=f&quot;.</p>
<p class="last">A name associated with a kind can be used as alternative to a
one-letter flag. See &quot;Letters and names&quot; for more details.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--&lt;LANG&gt;-kinds=[+|-]kinds|*</span></tt></dt>
<dd>Equivalent to <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;=...</span></tt>. This option is kept for
backward-compatibility with Exuberant-ctags.</dd>
<dt><tt class="docutils literal"><span class="pre">--langdef=name</span></tt></dt>
<dd>Defines a new user-defined language, name, to be parsed with regular
expressions. Once defined, name may be used in other options taking
language names. The typical use of this option is to first define the
language, then map file names to it using <tt class="docutils literal"><span class="pre">--langmap</span></tt>, then specify regular
expressions using <tt class="docutils literal"><span class="pre">--regex-&lt;LANG&gt;</span></tt> to define how its tags are found.</dd>
<dt><tt class="docutils literal"><span class="pre">--langmap=map[,map[...]]</span></tt></dt>
<dd><p class="first">Controls how file names are mapped to languages (see the <tt class="docutils literal"><span class="pre">--list-maps</span></tt>
option). Each comma-separated <em>map</em> consists of the language name (either
a built-in or user-defined language), a colon, and a list of <strong>file
extensions</strong> and/or <strong>file name patterns</strong>. A file extension is specified by
preceding the extension with a period (e.g. &quot;.c&quot;). A file name pattern
is specified by enclosing the pattern in parentheses (e.g.
&quot;([Mm]akefile)&quot;).</p>
<p>If appropriate support is available from the runtime
library of your C compiler, then the file name pattern may contain the usual
shell wildcards common on Unix (be sure to quote the option parameter to
protect the wildcards from being expanded by the shell before being
passed to ctags). You can determine if shell wildcards
are available on your platform by examining the output of the
<tt class="docutils literal"><span class="pre">--list-features</span></tt> option, which will include &quot;wildcards&quot; in the compiled
feature list; otherwise, the file name patterns are matched against
file names using a simple textual comparison.</p>
<p>When mapping a file extension with <tt class="docutils literal"><span class="pre">--langmap</span></tt> option,
it will first be unmapped from any other languages. (<tt class="docutils literal"><span class="pre">--map-&lt;LANG&gt;</span></tt>
option provides more fine-grained control.)</p>
<p>If the first character in a map is a plus sign ('+'), then the extensions and
file name patterns in that map will be appended to the current map
for that language; otherwise, the map will replace the current map.
For example, to specify that only files with extensions of .c and .x are
to be treated as C language files, use &quot;--langmap=c:.c.x&quot;; to also add
files with extensions of .j as Java language files, specify
&quot;--langmap=c:.c.x,java:+.j&quot;. To map makefiles (e.g. files named either
&quot;Makefile&quot;, &quot;makefile&quot;, or having the extension &quot;.mak&quot;) to a language
called &quot;make&quot;, specify &quot;--langmap=make:([Mm]akefile).mak&quot;. To map files
having no extension, specify a period not followed by a non-period
character (e.g. &quot;.&quot;, &quot;..x&quot;, &quot;.x.&quot;).</p>
<p>To clear the mapping for a
particular language (thus inhibiting automatic generation of tags for
that language), specify an empty extension list (e.g. &quot;--langmap=fortran:&quot;).
To restore the default language mappings for a particular language,
supply the keyword &quot;default&quot; for the mapping. To specify restore the
default language mappings for all languages, specify &quot;--langmap=default&quot;.</p>
<p class="last">Note that file name patterns are tested before file extensions when inferring
the language of a file. This order of Universal-ctags is different from
Exuberant-ctags. See ctags-incompatibilities(7) for the background of
this incompatible change.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--language-force=language</span></tt></dt>
<dd>By default, ctags automatically selects the language
of a source file, ignoring those files whose language cannot be
determined (see &quot;SOURCE FILES&quot;, above). This option forces the specified
<em>language</em> (case-insensitive; either built-in or user-defined) to be used
for every supplied file instead of automatically selecting the language
based upon its extension. In addition, the special value &quot;auto&quot; indicates
that the language should be automatically selected (which effectively
disables this option).</dd>
<dt><tt class="docutils literal"><span class="pre">--languages=[+|-]list</span></tt></dt>
<dd><p class="first">Specifies the languages for which tag generation is enabled, with <em>list</em>
containing a comma-separated list of language names (case-insensitive;
either built-in or user-defined). If the first language of <em>list</em> is not
preceded by either a '+' or '-', the current list (the current settings
of enabled/disabled languages managed in ctags internally)
will be cleared before adding or removing the languages in <em>list</em>. Until a '-' is
encountered, each language in the <em>list</em> will be added to the current list.
As either the '+' or '-' is encountered in the <em>list</em>, the languages
following it are added or removed from the current list, respectively.
Thus, it becomes simple to replace the current list with a new one, or
to add or remove languages from the current list.</p>
<p>The actual list of
files for which tags will be generated depends upon the language
extension mapping in effect (see the <tt class="docutils literal"><span class="pre">--langmap</span></tt> option). Note that the most of all
languages, including user-defined languages are enabled unless explicitly
disabled using this option. Language names included in list may be any
built-in language or one previously defined with <tt class="docutils literal"><span class="pre">--langdef</span></tt>. The default
is &quot;all&quot;, which is also accepted as a valid argument. See the
<tt class="docutils literal"><span class="pre">--list-languages</span></tt> option for a list of the all (built-in and user-defined)
language names.</p>
<p class="last">Note <tt class="docutils literal"><span class="pre">--languages=</span></tt> option works cumulative way; the option can be
specified with different arguments multiple times in a command line.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--license</span></tt></dt>
<dd>Prints a summary of the software license to standard output, and then exits.</dd>
<dt><tt class="docutils literal"><span class="pre">--line-directives[=yes|no]</span></tt></dt>
<dd>Specifies whether &quot;#line&quot; directives should be recognized. These are
present in the output of preprocessors and contain the line number, and
possibly the file name, of the original source file(s) from which the
preprocessor output file was generated. When enabled, this option will
cause ctags to generate tag entries marked with the
file names and line numbers of their locations original source file(s),
instead of their actual locations in the preprocessor output. The actual
file names placed into the tag file will have the same leading path
components as the preprocessor output file, since it is assumed that
the original source files are located relative to the preprocessor
output file (unless, of course, the #line directive specifies an
absolute path). This option is off by default. Note: This option is generally
only useful when used together with the <tt class="docutils literal"><span class="pre">--excmd=number</span></tt> (<tt class="docutils literal"><span class="pre">-n</span></tt>) option.
Also, you may have to use either the <tt class="docutils literal"><span class="pre">--langmap</span></tt> or <tt class="docutils literal"><span class="pre">--language-force</span></tt> option
if the extension of the preprocessor output file is not known to
ctags.</dd>
<dt><tt class="docutils literal"><span class="pre">--links[=yes|no]</span></tt></dt>
<dd>Indicates whether symbolic links (if supported) should be followed.
When disabled, symbolic links are ignored. This option is on by default.</dd>
<dt><tt class="docutils literal"><span class="pre">--list-aliases[=language|all]</span></tt></dt>
<dd>Lists the aliases for either the specified language or all
languages, and then exits. The aliases are used in when guessing
a parser for a source file.</dd>
<dt><tt class="docutils literal"><span class="pre">--list-extras[=languages|all]</span></tt></dt>
<dd><p class="first">Lists the extras recognized for either the specified language or
&quot;all&quot; languages. See &quot;Extras&quot; subsection to know what are extras.</p>
<p>An extra can be enabled or disabled with <tt class="docutils literal"><span class="pre">--extras=</span></tt> for common
extras in all languages, or <tt class="docutils literal"><span class="pre">--extras-&lt;LANG&gt;=</span></tt> for the specified
language.  These option takes one-letter flag or name as a parameter
for specifying an extra.</p>
<p>The meaning of columns are as follows:</p>
<dl class="last docutils">
<dt>LETTER</dt>
<dd>One-letter flag. '-' means the extra does not have one-letter flag.</dd>
<dt>NAME</dt>
<dd>The name of extra. The name is used in <tt class="docutils literal">extras:</tt> field.</dd>
<dt>ENABLED</dt>
<dd>Whether the extra is enabled or not. It takes &quot;yes&quot; or &quot;no&quot;.</dd>
<dt>LANGUAGE</dt>
<dd>The name of language if the extra is owned by a parser.
&quot;NONE&quot; means the extra is common in parsers.</dd>
<dt>DESCRIPTION</dt>
<dd>Human readable description for the extra.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-features</span></tt></dt>
<dd>Lists the compiled features.</dd>
<dt><tt class="docutils literal"><span class="pre">--list-fields[=language|all]</span></tt></dt>
<dd><p class="first">Lists the fields recognized for either the specified language or
&quot;all&quot; languages. See &quot;Fields&quot; subsection to know what are fields.</p>
<!-- TODO? xref output -->
<p>A field can be enabled or disabled with <tt class="docutils literal"><span class="pre">--fields=</span></tt> for common
extras in all languages, or <tt class="docutils literal"><span class="pre">--fields-&lt;LANG&gt;=</span></tt> for the specified
language.  These option takes one-letter flag or name as a parameter
for specifying a field.</p>
<p>The meaning of columns are as follows:</p>
<dl class="last docutils">
<dt>LETTER</dt>
<dd>One-letter flag. '-' means the field does not have one-letter flag.</dd>
<dt>NAME</dt>
<dd>The name of field.</dd>
<dt>ENABLED</dt>
<dd>Whether the field is enabled or not. It takes &quot;yes&quot; or &quot;no&quot;.</dd>
<dt>LANGUAGE</dt>
<dd>The name of language if the field is owned by a parser.
&quot;NONE&quot; means the extra is common in parsers.</dd>
<dt>JSTYPE</dt>
<dd><p class="first">Json type used in printing the value of field when &quot;--output-format=json&quot;
is specified.</p>
<p>Following characters are used for representing types.</p>
<dl class="docutils">
<dt>s</dt>
<dd>string</dd>
<dt>i</dt>
<dd>integer</dd>
<dt>b</dt>
<dd>boolean (true or false)</dd>
</dl>
<p class="last">The representation of this field and the output format used in
&quot;--output-format=json&quot; are still experimental.</p>
</dd>
<dt>FIXED</dt>
<dd>Whether this field can be disabled or not. Some fields are printed always
in tags output. They have &quot;yes&quot; as the value for this column.</dd>
<dt>DESCRIPTION</dt>
<dd>Human readable description for the field.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-kinds[=language|all]</span></tt></dt>
<dd><p class="first">Subset of <tt class="docutils literal"><span class="pre">--list-kinds-full</span></tt>. This option is kept for
backward-compatibility with Exuberant-ctags.</p>
<p>This option prints only LETTER, DESCRIPTION, and ENABLED fields
of <tt class="docutils literal"><span class="pre">--list-kinds-full</span></tt> output. However, the presentation of
ENABLED column is different from that of <tt class="docutils literal"><span class="pre">--list-kinds-full</span></tt>
option; &quot;[off]&quot; follows after description if the kind is disabled,
and nothing follows     if enabled. The most of all kinds are enabled
by default.</p>
<p>The critical weakness of this option is that this option does not
print the name of kind. Universal-ctags introduces
<tt class="docutils literal"><span class="pre">--list-kinds-full</span></tt> because it considers that names are
important.</p>
<p class="last">This option does not work with <tt class="docutils literal"><span class="pre">--machinable</span></tt> nor
<tt class="docutils literal"><span class="pre">--with-list-header</span></tt>.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-kinds-full[=language|all]</span></tt></dt>
<dd><p class="first">Lists the tag kinds recognized for either the specified language
or &quot;all&quot; languages, and then exits. See &quot;Kinds&quot; subsection to
know what are kinds.</p>
<p>Each kind of tag recorded in the tag file is represented by a
one-letter flag, or name. They are also used to filter the tags
placed into the output through use of the <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;</span></tt>
option.</p>
<p>The meaning of columns are as follows:</p>
<dl class="last docutils">
<dt>LANGUAGE</dt>
<dd>The name of language having the kind.</dd>
<dt>LETTER</dt>
<dd>One-letter flag. This must be unique in a language.</dd>
<dt>NAME</dt>
<dd>Name of the kind. This can be used as the alternative
one-letter flag described above. If enabling 'K' field with
<tt class="docutils literal"><span class="pre">--fields=+K</span></tt>, ctags uses name instead of
letter in tags output. To enable/disable a kind with
<tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;</span></tt> option, name surrounded by braces instead
of letter. See &quot;Letters and names&quot; for details. This must be
unique in a language.</dd>
<dt>ENABLED</dt>
<dd>Whether the kind is enabled or not. It takes &quot;yes&quot; or &quot;no&quot;.</dd>
<dt>REFONLY</dt>
<dd>Whether the kind is specialized for reference tagging or not.
If the column is &quot;yes&quot;, the kind is for reference tagging, and
it is never used for definition tagging. See also &quot;TAG ENTRIES&quot;.</dd>
<dt>NROLES</dt>
<dd>The number of roles this kind has. See also &quot;Roles&quot;.</dd>
<dt>MASTER</dt>
<dd><p class="first">The master parser controlling enablement of the kind.
A kind belongs to a language (owner) in Universal-ctags;
enabling and disabling a kind in a language has no effect on
a kind in another language even if the both kinds has the
same letter and/or the same name. In other words,
the namespace of kinds are separated by language.</p>
<p>However, Exuberant-ctags does not separate the kinds of C and
C++. Enabling/disabling kindX in C language enables/disables a
kind in C++ language having the same name with kindX. To
emulate this behavior in Universal-ctags, a concept named
&quot;master parser&quot; is introduced. Enabling/disabling some kinds
are synchronized under the control of a master language.</p>
<pre class="code console literal-block">
<span class="generic prompt">$</span> ctags --kinds-C<span class="operator">=</span>+<span class="literal string single">'{local}'</span> --list-kinds-full <span class="literal string escape">\
</span>  <span class="punctuation">|</span> grep -E <span class="literal string single">'^(#|C\+\+ .* local)'</span>
<span class="generic prompt">#</span>LANGUAGE  LETTER NAME   ENABLED REFONLY NROLES MASTER DESCRIPTION
<span class="generic output">C++        l      local  yes     no      0      C      local variables
</span><span class="generic prompt">$</span> ctags --kinds-C<span class="operator">=</span>-<span class="literal string single">'{local}'</span> --list-kinds-full <span class="literal string escape">\
</span>  <span class="punctuation">|</span> grep -E <span class="literal string single">'^(#|C\+\+ .* local)'</span>
<span class="generic prompt">#</span>LANGUAGE  LETTER NAME   ENABLED REFONLY NROLES MASTER DESCRIPTION
<span class="generic output">C++        l      local  no      no      0      C      local variables</span>
</pre>
<p class="last">You see &quot;ENABLED&quot; field of &quot;local&quot; kind of C++ language is changed
Though &quot;local&quot; kind of C language is enabled/disabled. If you swap the languages, you
see the same result.</p>
</dd>
<dt>DESCRIPTION</dt>
<dd>Human readable description for the kind.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-languages</span></tt></dt>
<dd><p class="first">Lists the names of the languages understood by ctags,
and then exits. These language names are case insensitive and may be
used in many other options like <tt class="docutils literal"><span class="pre">--language-force</span></tt>,
<tt class="docutils literal"><span class="pre">--languages</span></tt>, <tt class="docutils literal"><span class="pre">--kinds-&lt;LANG&gt;</span></tt>, <tt class="docutils literal"><span class="pre">--regex-&lt;LANG&gt;</span></tt>, and so on.</p>
<p>Each language listed is disabled if followed by &quot;[disabled]&quot;.
To use the parser for such a language, specify the language as an
argument of <tt class="docutils literal"><span class="pre">--languages=+</span></tt> option.</p>
<p class="last">This option does not work with <tt class="docutils literal"><span class="pre">--machinable</span></tt> nor
<tt class="docutils literal"><span class="pre">--with-list-header</span></tt>.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-map-extensions[=language|all]</span></tt></dt>
<dd>Lists the file extensions which associate a file
name with a language for either the specified <em>language</em> or <strong>all</strong>
languages, and then exits.</dd>
<dt><tt class="docutils literal"><span class="pre">--list-map-patterns[=language|all]</span></tt></dt>
<dd>Lists the file name patterns which associate a file
name with a language for either the specified <em>language</em> or <strong>all</strong>
languages, and then exits.</dd>
<dt><tt class="docutils literal"><span class="pre">--list-maps[=language|all]</span></tt></dt>
<dd><p class="first">Lists file name patterns and the file extensions which associate a file
name with a language for either the specified <em>language</em> or <strong>all</strong>
languages, and then exits. See the <tt class="docutils literal"><span class="pre">--langmap</span></tt> option, and &quot;SOURCE FILES&quot;, above.</p>
<p>To list the file extensions or file name patterns individually, use
<tt class="docutils literal"><span class="pre">--list-map-extensions</span></tt> or <tt class="docutils literal"><span class="pre">--list-map-patterns</span></tt> option.
See the <tt class="docutils literal"><span class="pre">--langmap</span></tt> option, and &quot;SOURCE FILES&quot;, above.</p>
<p class="last">This option does not work with <tt class="docutils literal"><span class="pre">--machinable</span></tt> nor
<tt class="docutils literal"><span class="pre">--with-list-header</span></tt>.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--list-roles[=language|all[.kinds]]</span></tt></dt>
<dd><p class="first">List the roles for either the specified language or &quot;all&quot;
languages. If the parameter kinds is given after the parameter
language or &quot;all&quot; with concatenating with '.', list only roles
defined in the kinds. Both one-letter flags and names surrounded
by braces are acceptable as the parameter kinds.</p>
<p>The meaning of columns are as follows:</p>
<dl class="last docutils">
<dt>LANGUAGE</dt>
<dd>Name of language having the role.</dd>
<dt>KIND(L/N)</dt>
<dd>One-letter flag and name of kind having the role.</dd>
<dt>NAME</dt>
<dd>Name of the role.</dd>
<dt>ENABLED</dt>
<dd>Whether the kind is enabled or not. It takes &quot;yes&quot; or &quot;no&quot;.
(Currently all roles are enabled. No option for disabling
a specified role is not implemented yet.)</dd>
<dt>DESCRIPTION</dt>
<dd>Human readable description for the role.</dd>
</dl>
</dd>
<dt><tt class="docutils literal"><span class="pre">--machinable[=yes|no]</span></tt></dt>
<dd>Use tab character as separators for <tt class="docutils literal"><span class="pre">--list-</span></tt> option output.  It
may be suitable for scripting. See &quot;List options&quot; for considered
use cases. Disabled by default.</dd>
<dt><tt class="docutils literal"><span class="pre">--map-&lt;LANG&gt;=[+|-]extension|pattern</span></tt></dt>
<dd><p class="first">This option provides the way to control mapping(s) of file names to
languages more fine-grained way than <tt class="docutils literal"><span class="pre">--langmap</span></tt> option.</p>
<p>In ctags, more than one language can map to a
file name pattern or file extension (<em>N:1 map</em>). Alternatively,
<tt class="docutils literal"><span class="pre">--langmap</span></tt> option handle only <em>1:1 map</em>, only one language
mapping to one file name pattern or file extension.  A typical N:1
map is seen in C++ and ObjectiveC language; both languages have
a map to &quot;.h&quot; as a file extension.</p>
<p>A file extension is specified by preceding the extension with a period (e.g. &quot;.c&quot;).
A file name pattern is specified by enclosing the pattern in parentheses (e.g.
&quot;([Mm]akefile)&quot;). A prefixed plus ('+') sign is for adding, and
minus ('-') is for removing. No prefix means replacing the map of <em>&lt;LANG&gt;</em>.</p>
<p class="last">Unlike <tt class="docutils literal"><span class="pre">--langmap</span></tt>, <em>extension</em> (or <em>pattern</em>) is not a list.
<tt class="docutils literal"><span class="pre">--map-&lt;LANG&gt;</span></tt> takes one <em>extension</em> (or <em>pattern</em>). However,
the option can be specified with different arguments multiple times
in a command line.</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--maxdepth</span></tt></dt>
<dd>Limits the depth of directory recursion enabled with the <tt class="docutils literal"><span class="pre">--recurse</span></tt>
(<tt class="docutils literal"><span class="pre">-R</span></tt>) option.</dd>
<dt><tt class="docutils literal"><span class="pre">--optlib-dir=[+]directory</span></tt></dt>
<dd>Add an optlib <em>directory</em> to or reset <strong>optlib</strong> path list.
By default, the optlib path list is empty.</dd>
<dt><tt class="docutils literal"><span class="pre">--options=pathname</span></tt></dt>
<dd><p class="first">Read additional options from file or directory.</p>
<p>ctags searches <em>pathname</em> in optlib path list
first. If ctags cannot find a file or directory
in the list, ctags reads a file or directory
at the specified <em>pathname</em>.</p>
<p>If a file is specified, it should contain one option per line. If
a directory is specified, files suffixed with &quot;.ctags&quot; under it
are read in alphabetical order.</p>
<p class="last">As a special case, if &quot;--options=NONE&quot; is specified as the first
option on the command line, preloading is disabled; the option
will disable the automatic reading of any configuration options
from either a file or the environment (see &quot;FILES&quot;).</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--options-maybe=pathname</span></tt></dt>
<dd>Same as <tt class="docutils literal"><span class="pre">--options</span></tt> but doesn't cause an error if file
(or directory) specified with <em>pathname</em> doesn't exist.</dd>
<dt><tt class="docutils literal"><span class="pre">--print-language</span></tt></dt>
<dd>Just prints the parsers for specified source files, and then exits.</dd>
<dt><tt class="docutils literal"><span class="pre">--quiet[=yes|no]</span></tt></dt>
<dd>Write fewer messages (default is no).</dd>
<dt><tt class="docutils literal"><span class="pre">--recurse[=yes|no]</span></tt></dt>
<dd>Recurse into directories encountered in the list of supplied files.
If the list of supplied files is empty and no file list is specified with
the -L option, then the current directory (i.e. &quot;.&quot;) is assumed.
Symbolic links are followed. If you don't like these behaviors, either
explicitly specify the files or pipe the output of find(1) into
ctags -L- instead. Note: This option is not supported on
all platforms at present. It is available if the output of the <tt class="docutils literal"><span class="pre">--help</span></tt>
option includes this option. See, also, the <tt class="docutils literal"><span class="pre">--exclude</span></tt> to limit
recursion.</dd>
<dt><tt class="docutils literal"><span class="pre">--regex-&lt;LANG&gt;=/regexp/replacement/[kind-spec/][flags]</span></tt></dt>
<dd><p class="first">The /regexp/replacement/ pair define a regular expression replacement
pattern, similar in style to sed substitution commands, with which to
generate tags from source files mapped to the named language, &lt;LANG&gt;,
(case-insensitive; either a built-in or user-defined language). The
regular expression, regexp, defines an extended regular expression
(roughly that used by egrep(1)), which is used to locate a single source
line containing a tag and may specify tab characters using t. When a
matching line is found, a tag will be generated for the name defined by
replacement, which generally will contain the special back-references
1 through 9 to refer to matching sub-expression groups within regexp.
The '/' separator characters shown in the parameter to the option can
actually be replaced by any character. Note that whichever separator
character is used will have to be escaped with a backslash ('')
character wherever it is used in the parameter as something other than a
separator. The regular expression defined by this option is added to the
current list of regular expressions for the specified language
unless the parameter is omitted, in which case the current list is cleared.</p>
<p>Unless modified by flags, regexp is interpreted as a Posix extended
regular expression. The replacement should expand for all matching lines
to a non-empty string of characters, or a warning message will be
reported. An optional kind specifier for tags matching regexp may follow
replacement, which will determine what kind of tag is reported in the
&quot;kind&quot; extension field (see &quot;TAG FILE FORMAT&quot;, below). The full form of
kind-spec is in the form of a single letter, a comma, a name (without
spaces), a comma, a description, followed by a separator, which specify
the short and long forms of the kind value and its textual description
(displayed using <tt class="docutils literal"><span class="pre">--list-kinds</span></tt>). Either the kind name and/or the
description may be omitted. If kind-spec is omitted, it defaults to
&quot;r,regex&quot;. Finally, flags are one or more single-letter characters having
the following effect upon the interpretation of regexp:</p>
<blockquote>
<dl class="docutils">
<dt>b</dt>
<dd>The pattern is interpreted as a Posix basic regular expression.</dd>
<dt>e</dt>
<dd>The pattern is interpreted as a Posix extended regular expression (default).</dd>
<dt>i</dt>
<dd>The regular expression is to be applied in a case-insensitive manner.</dd>
</dl>
</blockquote>
<p>Note that this option is available only if ctags was
compiled with support for regular expressions, which depends upon your
platform. You can determine if support for regular expressions is
compiled in by examining the output of the <tt class="docutils literal"><span class="pre">--list-features</span></tt> option, which will
include &quot;regex&quot; in the compiled feature list.</p>
<p class="last">For more information on the regular expressions used by
ctags, see either the regex(5,7) man page, or the GNU
info documentation for regex (e.g. &quot;info regex&quot;).</p>
</dd>
<dt><tt class="docutils literal"><span class="pre">--sort[=yes|no|foldcase]</span></tt></dt>
<dd>Indicates whether the tag file should be sorted on the tag name
(default is yes). Note that the original vi(1) required sorted tags.
The foldcase value specifies case insensitive (or case-folded) sorting.
Fast binary searches of tag files sorted with case-folding will require
special support from tools using tag files, such as that found in the
ctags readtags library, or Vim version 6.2 or higher
(using &quot;set ignorecase&quot;). This option must appear before the first file
name. [Ignored in etags mode]</dd>
<dt><tt class="docutils literal"><span class="pre">--tag-relative[=yes|no]</span></tt></dt>
<dd>Indicates that the file paths recorded in the tag file should be
relative to the directory containing the tag file, rather than relative
to the current directory, unless the files supplied on the command line
are specified with absolute paths. This option must appear before the
first file name. The default is yes when running in etags mode (see
the <tt class="docutils literal"><span class="pre">-e</span></tt> option), no otherwise.</dd>
<dt><tt class="docutils literal"><span class="pre">--totals[=yes|no]</span></tt></dt>
<dd>Prints statistics about the source files read and the tag file written
during the current invocation of ctags. This option
is off by default. This option must appear before the first file name.</dd>
<dt><tt class="docutils literal"><span class="pre">--undef[=yes|no]</span></tt></dt>
<dd>Specifies whether a macro tag should be generated from an #undef CPP
directive (in a C/C++ file), as if it were a #define directive. This
option is enabled by default.</dd>
<dt><tt class="docutils literal"><span class="pre">--verbose[=yes|no]</span></tt></dt>
<dd>Enable verbose mode. This prints out information on option processing
and a brief message describing what action is being taken for each file
considered by ctags. Normally, ctags
does not read command line arguments until after options are read
from the configuration files (see &quot;FILES&quot;, below) and the CTAGS
environment variable. However, if this option is the first argument on
the command line, it will take effect before any options are read from
these sources. The default is no.</dd>
<dt><tt class="docutils literal"><span class="pre">--with-list-header[=yes|no]</span></tt></dt>
<dd>Print headers describing columns in <tt class="docutils literal"><span class="pre">--list-</span></tt> option output.
See also &quot;List options&quot;.</dd>
<dt><tt class="docutils literal"><span class="pre">--version</span></tt></dt>
<dd>Prints a version identifier for ctags to standard
output, and then exits. This is guaranteed to always contain the string
&quot;Universal Ctags&quot;.</dd>
</dl>
</div>
<div class="section" id="operational-details">
<h1>OPERATIONAL DETAILS</h1>
<p>As ctags considers each file name in turn, it tries to
determine the language of the file by applying the following three tests
in order: if the file extension has been mapped to a language, if the
filename matches a shell pattern mapped to a language, and finally if the
file is executable and its first line specifies an interpreter using the
Unix-style &quot;#!&quot; specification (if supported on the platform). If a
language was identified, the file is opened and then the appropriate
language parser is called to operate on the currently open file. The parser
parses through the file and adds an entry to the tag file for each
language object it is written to handle. See &quot;TAG FILE FORMAT&quot;, below, for
details on these entries.</p>
<p>This implementation of ctags imposes no formatting
requirements on C code as do legacy implementations. Older implementations
of ctags tended to rely upon certain formatting assumptions in order to
help it resolve coding dilemmas caused by preprocessor conditionals.</p>
<p>In general, ctags tries to be smart about conditional
preprocessor directives. If a preprocessor conditional is encountered
within a statement which defines a tag, ctags follows
only the first branch of that conditional (except in the special case of
&quot;#if 0&quot;, in which case it follows only the last branch). The reason for
this is that failing to pursue only one branch can result in ambiguous
syntax, as in the following example:</p>
<pre class="code C literal-block">
<span class="comment preproc">#ifdef TWO_ALTERNATIVES
</span><span class="keyword">struct</span> <span class="punctuation">{</span>
<span class="comment preproc">#else
</span><span class="keyword">union</span> <span class="punctuation">{</span>
<span class="comment preproc">#endif
</span>        <span class="keyword type">short</span> <span class="name">a</span><span class="punctuation">;</span>
        <span class="keyword type">long</span> <span class="name">b</span><span class="punctuation">;</span>
<span class="punctuation">}</span>
</pre>
<p>Both branches cannot be followed, or braces become unbalanced and
ctags would be unable to make sense of the syntax.</p>
<p>If the application of this heuristic fails to properly parse a file,
generally due to complicated and inconsistent pairing within the
conditionals, ctags will retry the file using a
different heuristic which does not selectively follow conditional
preprocessor branches, but instead falls back to relying upon a closing
brace (&quot;}&quot;) in column 1 as indicating the end of a block once any brace
imbalance results from following a #if conditional branch.</p>
<p>ctags will also try to specially handle arguments lists
enclosed in double sets of parentheses in order to accept the following
conditional construct:</p>
<blockquote>
extern void foo __ARGS((int one, char two));</blockquote>
<p>Any name immediately preceding the &quot;((&quot; will be automatically ignored and
the previous name will be used.</p>
<p>C++ operator definitions are specially handled. In order for consistency
with all types of operators (overloaded and conversion), the operator
name in the tag file will always be preceded by the string &quot;operator &quot;
(i.e. even if the actual operator definition was written as &quot;operator&lt;&lt;&quot;).</p>
<p>After creating or appending to the tag file, it is sorted by the tag name,
removing identical tag lines.</p>
</div>
<div class="section" id="tag-file-format">
<h1>TAG FILE FORMAT</h1>
<p>When not running in etags mode, each entry in the tag file consists of a
separate line, each looking like this in the most general case:</p>
<p>tag_name&lt;TAB&gt;file_name&lt;TAB&gt;ex_cmd;&quot;&lt;TAB&gt;extension_fields</p>
<p>The fields and separators of these lines are specified as follows:</p>
<blockquote>
<ol class="arabic simple">
<li>tag name</li>
<li>single tab character</li>
<li>name of the file in which the object associated with the tag is located</li>
<li>single tab character</li>
<li>EX command used to locate the tag within the file; generally a
search pattern (either /pattern/ or ?pattern?) or line number (see
<tt class="docutils literal"><span class="pre">--excmd</span></tt>). Tag file format 2 (see <tt class="docutils literal"><span class="pre">--format</span></tt>) extends this EX command
under certain circumstances to include a set of extension fields
(described below) embedded in an EX comment immediately appended
to the EX command, which leaves it backward-compatible with original
vi(1) implementations.</li>
</ol>
</blockquote>
<p>A few special tags are written into the tag file for internal purposes.
These tags are composed in such a way that they always sort to the top of
the file. Therefore, the first two characters of these tags are used a magic
number to detect a tag file for purposes of determining whether a
valid tag file is being overwritten rather than a source file.</p>
<p>Note that the name of each source file will be recorded in the tag file
exactly as it appears on the command line. Therefore, if the path you
specified on the command line was relative to the current directory, then
it will be recorded in that same manner in the tag file. See, however,
the <tt class="docutils literal"><span class="pre">--tag-relative</span></tt> option for how this behavior can be modified.</p>
<p>Extension fields are tab-separated key-value pairs appended to the end of
the EX command as a comment, as described above. These key value pairs
appear in the general form &quot;key:value&quot;. Their presence in the lines of the
tag file are controlled by the <tt class="docutils literal"><span class="pre">--fields</span></tt> option. The possible keys and
the meaning of their values are as follows:</p>
<dl class="docutils">
<dt>access</dt>
<dd>Indicates the visibility of this class member, where value is specific
to the language.</dd>
<dt>file</dt>
<dd>Indicates that the tag has file-limited visibility. This key has no
corresponding value.</dd>
<dt>kind</dt>
<dd>Indicates the type, or kind, of tag. Its value is either one of the
corresponding one-letter flags described under the various
<tt class="docutils literal"><span class="pre">--&lt;LANG&gt;-kinds</span></tt> options above, or a full name. It is permitted
(and is, in fact, the default) for the key portion of this field to be
omitted. The optional behaviors are controlled with the <tt class="docutils literal"><span class="pre">--fields</span></tt> option.</dd>
<dt>implementation</dt>
<dd>When present, this indicates a limited implementation (abstract vs.
concrete) of a routine or class, where value is specific to the
language (&quot;virtual&quot; or &quot;pure virtual&quot; for C++; &quot;abstract&quot; for Java).</dd>
<dt>inherits</dt>
<dd>When present, value. is a comma-separated list of classes from which
this class is derived (i.e. inherits from).</dd>
<dt>signature</dt>
<dd>When present, value is a language-dependent representation of the
signature of a routine. A routine signature in its complete form
specifies the return type of a routine and its formal argument list.
This extension field is presently supported only for C-based
languages and does not include the return type.</dd>
</dl>
<p>In addition, information on the scope of the tag definition may be
available, with the key portion equal to some language-dependent construct
name and its value the name declared for that construct in the program.
This scope entry indicates the scope in which the tag was found.
For example, a tag generated for a C structure member would have a scope
looking like &quot;struct:myStruct&quot;.</p>
</div>
<div class="section" id="how-to-use-with-vi">
<h1>HOW TO USE WITH VI</h1>
<p>Vi will, by default, expect a tag file by the name &quot;tags&quot; in the current
directory. Once the tag file is built, the following commands exercise
the tag indexing feature:</p>
<dl class="docutils">
<dt>vi -t tag</dt>
<dd>Start vi and position the cursor at the file and line where &quot;tag&quot;
is defined.</dd>
<dt>:ta tag</dt>
<dd>Find a tag.</dd>
<dt>Ctrl-]</dt>
<dd>Find the tag under the cursor.</dd>
<dt>Ctrl-T</dt>
<dd>Return to previous location before jump to tag (not widely implemented).</dd>
</dl>
</div>
<div class="section" id="how-to-use-with-gnu-emacs">
<h1>HOW TO USE WITH GNU EMACS</h1>
<p>Emacs will, by default, expect a tag file by the name &quot;TAGS&quot; in the
current directory. Once the tag file is built, the following commands
exercise the tag indexing feature:</p>
<dl class="docutils">
<dt>M-x visit-tags-table &lt;RET&gt; FILE &lt;RET&gt;</dt>
<dd>Select the tag file, &quot;FILE&quot;, to use.</dd>
<dt>M-. [TAG] &lt;RET&gt;</dt>
<dd>Find the first definition of TAG. The default tag is the identifier
under the cursor.</dd>
<dt>M-*</dt>
<dd>Pop back to where you previously invoked &quot;M-.&quot;.</dd>
<dt>C-u M-.</dt>
<dd>Find the next definition for the last tag.</dd>
</dl>
<p>For more commands, see the Tags topic in the Emacs info document.</p>
</div>
<div class="section" id="how-to-use-with-nedit">
<h1>HOW TO USE WITH NEDIT</h1>
<p>NEdit version 5.1 and later can handle the new extended tag file format
(see <tt class="docutils literal"><span class="pre">--format</span></tt>). To make NEdit use the tag file, select &quot;File-&gt;Load Tags
File&quot;. To jump to the definition for a tag, highlight the word, then press
Ctrl-D. NEdit 5.1 can read multiple tag files from different
directories. Setting the X resource nedit.tagFile to the name of a tag
file instructs NEdit to automatically load that tag file at startup time.</p>
</div>
<div class="section" id="caveats">
<h1>CAVEATS</h1>
<p>Because ctags is neither a preprocessor nor a compiler,
use of preprocessor macros can fool ctags into either
missing tags or improperly generating inappropriate tags. Although
ctags has been designed to handle certain common cases,
this is the single biggest cause of reported problems. In particular,
the use of preprocessor constructs which alter the textual syntax of C
can fool ctags. You can work around many such problems
by using the <tt class="docutils literal"><span class="pre">-I</span></tt> option.</p>
<p>Note that since ctags generates patterns for locating
tags (see the <tt class="docutils literal"><span class="pre">--excmd</span></tt> option), it is entirely possible that the wrong line
may be found by your editor if there exists another source line which is
identical to the line containing the tag. The following example
demonstrates this condition:</p>
<pre class="code C literal-block">
<span class="keyword type">int</span> <span class="name">variable</span><span class="punctuation">;</span>

<span class="comment multiline">/* ... */</span>
<span class="keyword type">void</span> <span class="name function">foo</span><span class="punctuation">(</span><span class="name">variable</span><span class="punctuation">)</span>
<span class="keyword type">int</span> <span class="name">variable</span><span class="punctuation">;</span>
<span class="punctuation">{</span>
        <span class="comment multiline">/* ... */</span>
<span class="punctuation">}</span>
</pre>
<p>Depending upon which editor you use and where in the code you happen to be,
it is possible that the search pattern may locate the local parameter
declaration in foo() before it finds the actual global variable definition,
since the lines (and therefore their search patterns are identical).
This can be avoided by use of the <tt class="docutils literal"><span class="pre">--excmd=n</span></tt> option.</p>
</div>
<div class="section" id="bugs">
<h1>BUGS</h1>
<p>ctags has more options than ls(1).</p>
<p>When parsing a C++ member function definition (e.g. &quot;className::function&quot;),
ctags cannot determine whether the scope specifier
is a class name or a namespace specifier and always lists it as a class name
in the scope portion of the extension fields. Also, if a C++ function
is defined outside of the class declaration (the usual case), the access
specification (i.e. public, protected, or private) and implementation
information (e.g. virtual, pure virtual) contained in the function
declaration are not known when the tag is generated for the function
definition. It will, however be available for prototypes (e.g. &quot;--c++-kinds=+p&quot;).</p>
<p>No qualified tags are generated for language objects inherited into a class.</p>
</div>
<div class="section" id="environment-variables">
<h1>ENVIRONMENT VARIABLES</h1>
<dl class="docutils">
<dt>CTAGS</dt>
<dd>If this environment variable exists, it will be expected to contain a
set of default options which are read when ctags
starts, after the configuration files listed in FILES, below, are read,
but before any command line options are read. Options appearing on
the command line will override options specified in this variable.
Only options will be read from this variable. Note that all white space
in this variable is considered a separator, making it impossible to pass
an option parameter containing an embedded space. If this is a problem,
use a configuration file instead.</dd>
<dt>ETAGS</dt>
<dd>Similar to the CTAGS variable above, this variable, if found, will be
read when etags starts. If this variable is not
found, etags will try to use CTAGS instead.</dd>
<dt>TMPDIR</dt>
<dd>On Unix-like hosts where mkstemp() is available, the value of this
variable specifies the directory in which to place temporary files.
This can be useful if the size of a temporary file becomes too large
to fit on the partition holding the default temporary directory
defined at compilation time. ctags creates temporary
files only if either (1) an emacs-style tag file is being
generated, (2) the tag file is being sent to standard output, or
(3) the program was compiled to use an internal sort algorithm to sort
the tag files instead of the sort utility of the operating system.
If the sort utility of the operating system is being used, it will
generally observe this variable also. Note that if ctags
is setuid, the value of TMPDIR will be ignored.</dd>
</dl>
</div>
<div class="section" id="files">
<h1>FILES</h1>
<p>$HOME/.ctags.d/*.ctags</p>
<p>$HOMEDRIVE$HOMEPATH/ctags.d/*.ctags (on MSWindows only)</p>
<p>.ctags.d/*.ctags</p>
<p>ctags.d/*.ctags</p>
<blockquote>
<p>If any of these configuration files exist, each will be expected to
contain a set of default options which are read in the order listed
when ctags starts, but before the CTAGS environment
variable is read or any command line options are read. This makes it
possible to set up personal or project-level defaults. It
is possible to compile ctags to read an additional
configuration file before any of those shown above, which will be
indicated if the output produced by the <tt class="docutils literal"><span class="pre">--version</span></tt> option lists the
&quot;custom-conf&quot; feature. Options appearing in the CTAGS environment
variable or on the command line will override options specified in these
files. Only options will be read from these files. Note that the option
files are read in line-oriented mode in which spaces are significant
(since shell quoting is not possible) but spaces at the beginning
of a line are ignored. Each line of the file is read as
one command line parameter (as if it were quoted with single quotes).
Therefore, use new lines to indicate separate command-line arguments.
A line starting with '#' is treated as a comment.</p>
<p>*.ctags files in a directory are loaded in alphabetical order.</p>
</blockquote>
<dl class="docutils">
<dt>tags</dt>
<dd>The default tag file created by ctags.</dd>
<dt>TAGS</dt>
<dd>The default tag file created by etags.</dd>
</dl>
</div>
<div class="section" id="see-also">
<h1>SEE ALSO</h1>
<p>The official Universal-ctags web site at:</p>
<p><a class="reference external" href="https://ctags.io/">https://ctags.io/</a></p>
<p>Also ex(1), vi(1), elvis, or, better yet, vim, the official editor of ctags.
For more information on vim, see the VIM Pages web site at:</p>
<p><a class="reference external" href="http://www.vim.org/">http://www.vim.org/</a></p>
</div>
<div class="section" id="author">
<h1>AUTHOR</h1>
<p>Universal-ctags project
<a class="reference external" href="https://ctags.io">https://ctags.io</a></p>
<p>Darren Hiebert &lt;<a class="reference external" href="mailto:dhiebert&#64;users.sourceforge.net">dhiebert&#64;users.sourceforge.net</a>&gt;
<a class="reference external" href="http://DarrenHiebert.com/">http://DarrenHiebert.com/</a></p>
</div>
<div class="section" id="motivation">
<h1>MOTIVATION</h1>
<p>&quot;Think ye at all times of rendering some service to every member of the
human race.&quot;</p>
<p>&quot;All effort and exertion put forth by man from the fullness of his heart is
worship, if it is prompted by the highest motives and the will to do
service to humanity.&quot;</p>
<p>-- From the Baha'i Writings</p>
</div>
<div class="section" id="credits">
<h1>CREDITS</h1>
<p>This version of ctags (Universal-ctags) derived from
the repository, known as <strong>fishman-ctags</strong>, started by Reza Jelveh.</p>
<p>Some parsers are taken from <strong>tagmanager</strong> of <strong>Geany</strong> (<a class="reference external" href="https://www.geany.org/">https://www.geany.org/</a>)
project.</p>
<p>The fishman-ctags was derived from Exuberant-ctags.</p>
<p>Exuberant-ctags was originally derived from and
inspired by the ctags program by Steve Kirkendall &lt;<a class="reference external" href="mailto:kirkenda&#64;cs.pdx.edu">kirkenda&#64;cs.pdx.edu</a>&gt;
that comes with the Elvis vi clone (though virtually none of the original
code remains).</p>
<p>Credit is also due Bram Moolenaar &lt;<a class="reference external" href="mailto:Bram&#64;vim.org">Bram&#64;vim.org</a>&gt;, the author of vim,
who has devoted so much of his time and energy both to developing the editor
as a service to others, and to helping the orphans of Uganda.</p>
<p>The section entitled &quot;HOW TO USE WITH GNU EMACS&quot; was shamelessly stolen
from the info page for GNU etags.</p>
</div>
</div>
</body>
</html>
